home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Tools / CodeReview 1.0 ƒ / ReadMe SimpleText < prev   
Text File  |  1996-07-27  |  3KB  |  106 lines

  1. CodeReview 1.0
  2.  
  3.  
  4.  
  5.  
  6.  
  7. A utility for C++ programmers who wish to calculate simple source code metrics including:
  8.  
  9. • Lines of Code
  10. • Lines containing comments
  11. • Number of Classes
  12. • Number of Methods
  13. • A simple measure of complexity
  14.  
  15. The program is simple to use. Run it and drag files or folders of files from the Finder™ to the main window. Then choose Measure to have the program measure each text file and calculate totals for the whole collection.
  16.  
  17. The collection document can be saved and then re-measured again later after the programmer has done more work.
  18.  
  19. The list of files and their individual statistics can be sorted to quickly point you to particular files that are getting too fat and complex.
  20.  
  21. This software is PostCardWare, (free really).
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43. Details
  44.  
  45. Ok, now the bad news... this is a very simple implementation. I’ve looked at what’s involved in measuring code complexity properly and even had a stab at a recursive descent parser for c++ but basically I would need to handle the searching and processing of #include files, the pre-processor, and full parsing of modern c++ to do this properly.
  46.  
  47. So, what I’ve done so far is to provide the infrastructure that can process a collection of files. The implementation here simply reads each file, line by line, and scores on a number of points:
  48.  
  49. Lines    = non-empty lines in each file.
  50. Comments = lines containing comments.
  51. Classes = lines with the word “class” in them!
  52. Methods = lines that look like a method implementation.
  53. Complexity = lines containing “if”, “else”, “switch”, or “case”.
  54.  
  55. I’m embarrassed just telling you this. But some sort of consistent measure is better than none at all. To see the gory details of how the program parsed your file, double-click it in the main window and it will open in a window with some symbols down the left margin.
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72. L = Counted as a line of code
  73. * = Counted as a comment line
  74. C = Counted as a class declaration
  75. M = Counted as a method implementation
  76. ! = Counted as 1 point of complexity
  77.  
  78. Use
  79.  
  80. Launch the program, drag either a collection of text files or folders of files into the body of the main window. The files you dragged in will be added or if folders were dragged in they will be recursively searched for all TEXT files.
  81.  
  82. Note that if you plan to add folders with large numbers of files (like all of MacApp for example) you’ll need to give the program more memory or it will run out and complain.
  83.  
  84. By default the sorting is by the name of each file. You can sort by other things by clicking the headings as you would in the Finder. The “pyramid” icon at the top right can be clicked to reverse the sort order.
  85.  
  86. Under the File menu there is a Save As Text… option which will save a report to a text file.
  87.  
  88. Credits and “payment”
  89.  
  90. Peter Marks wrote the program.
  91. Metrowerks Codewarrior 9 C++ was the compiler.
  92. MacApp Release 11 is the framework.
  93. Jim Luther and Apple DTS for MoreFiles.
  94.  
  95. Now, if you’d like to encourage me to produce more free software please send me a postcard on a technical theme and send it to:
  96.  
  97. Access Informatics
  98. 6 Donegal Road
  99. Killarney Heights 2087
  100. Australia
  101.  
  102. I’m keen to get feedback from people who might use this tool. Please send comments and suggestions to peter.marks@pobox.com
  103.  
  104. © 1996 Access Informatics, All Rights Reserved.
  105. Contact me for permission to include this in published collections.
  106.